<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .btn {
        display:inline-block;
        line-height: 1;
        white-space: nowrap;
        cursor: pointer;
        color: #409eff;
        background: #ecf5ff;
        border-color: #b3d8ff;
        text-align: center;
        box-sizing: border-box;
        padding: 12px 20px;
        font-size: 14px;
        border-radius: 4px;
    }
    </style>
</head>
<body>
    <script src="./js/vue.js"></script>
    <div id='app'>
       <counter inline-template><!--组件将其内部html内容作为模板，此时template内定义的模板不生效-->
            <button @click="num++">点击{{num}}次</button>
       </counter>
       <counter></counter><!--注册组件，模板使用complate内定义的模板-->
    </div>
    
    <script>
        Vue.component('counter',{
            data:()=>{
                return {
                    num:0
                }
            },
            template:'<button class="btn" @click="num++">计数{{num}}次</button>'
        })
        let app =new Vue({
             el:"#app",
             data:{
                
             }
        })
    </script>
</body>
</html>